<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue</title>
</head>
<script src="vue.js"></script>
<script src="node_modules/axios/dist/axios.js"></script>
<body>

    <div id="app">
        <input type="text" v-model="word">
        <h1>{{result}}</h1>
    </div>
<script>
    var app=new Vue({
        el:'#app',
        watch:{
            word:function (newV,oldV) {
                //console.log(newV+ '==>'+ oldV);
                var data=JSON.stringify({"params":newV});
                var url="http://www.dragonjun.com:8080/jersey/api/query/text";
                axios.post(url,data,{
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then(function (data) {
                    console.log(data.data.data);
                    app.result=data.data.data;
                }).catch(function (error) {
                    console.log('错误'+error);
                })
            }
        },
        data:{
           word:'',
            result:''

        }
    });

</script>
</body>
</html>